<?php
namespace view;

class HTMLFormsView {

    private $applicationModel;


    public function __construct()     {
        $this->applicationModel = new \model\ApplicationModel();
    }


	/**
    * @param String $loginStatus
	* @param String $formUsername
	* @param String $userName
	* @param String $formPassword
    * @param String $formStayLogedIn
	* @return String HTML
    *
    * return -> hur inloggning formuläret ska se ut
    */
    public function returnLoginForm($loginStatus,  $userName ) {
        return "
        		           <div id='header'>
                                <div id='logginform'>
                                    <form action='?".$this->applicationModel->m_loginURL."' method='post'>
                                        <fieldset>
                                            <legend>Sign In!</legend>
                                            <p>$loginStatus</p>
                                            <label for='username'>Username:</label>
                                            <input type='text' name='".$this->applicationModel->m_formUsername."' value='$userName'>
                                            <label for='password'>Password:</label>
                                            <input type='password' name='".$this->applicationModel->m_formPassword."'>
                                            <label for='rememberPassword'>Keep me loged in:</label>
                                            <input type='checkbox' name='".$this->applicationModel->m_formStayLogedIn."' value='1'>
                                            <input class='login' type='submit' name='".$this->applicationModel->m_formSubmit."' value='Logga in'>
                                        </fieldset>
                                    </form>
                                    <p><a href='?".$this->applicationModel->m_registerURL."'>Register new user</a></p>
                                </div>
                            </div>";
 	}


	/**
    * @param String $newUserMessage
	* @param String $newUserUsername
    * @return String HTML
    *
    * return -> hur registreringsformuläret ser ut ny användare
    */
    public function returnRegisterForm($newUserMessage, $newUserUsername) {
        return "
			            <div id='registerform'>
                                <form action='?".$this->applicationModel->m_registerURL."' method='post' enctype='multipart/form-data'>
                                    <fieldset>
                                         <legend>Register new user</legend>
                                         <p>$newUserMessage</p>
                                         <label for='UserNameID' >Username :</label>
                                         <input type='text' size='30' name='".$this->applicationModel->m_postNewUsername."' id='UserNameID' value='$newUserUsername' />
                                         <br>
                                         <label for='PasswordID' >Password :</label>
                                         <input type='password' size='20' name='".$this->applicationModel->m_postNewPassword."' id='PasswordID' value='' />
                                         <br>
                                         <label for='PasswordID2' >Re-enter Password :</label>
                                         <input type='password' size='20' name='".$this->applicationModel->m_postNewRetypedPassword."' id='PasswordID2' value='' />
                                         <br>
                                         <label for='RegistreraID' ></label>
                                         <input class='regi' type='submit' name='".$this->applicationModel->m_formSubmit."' value='Register' id='RegistreraID' />
                                     </fieldset>
                                </form>
                            </div>";
      }


	/**
    * @param String $blogStatusMessage
	* @param String $blogHeader
	* @param String $blogText
    * @return String HTML
    *
    * return -> skapa ny blogg post
    */
    public function returnPostForm($blogStatusMessage, $blogHeader, $blogText) {
        return"
					<div id='addblogpost'>
						<h2>Add new blogpost</h2>
                           <form action='?".$this->applicationModel->m_addBlogPostURL."' method='post' enctype='multipart/form-data'>
                                <fieldset>
                                     <p>$blogStatusMessage</p>
                                     <label for='blogHeader' >Add headline</label>
                                     <input type='text' size='50' name='".$this->applicationModel->m_postBlogHeader."' id='blogHeader' maxlength='20' value='$blogHeader' />
                                     <label for='blogText' >Add blogtext</label>
                                     <textarea type='text' rows='6' cols='60' name='".$this->applicationModel->m_postBlogText."' id='blogText' />$blogText</textarea>
                                     <input class='regi' type='submit' name='".$this->applicationModel->m_formSubmit."'  value='Register' id='RegistreraID' />
                                  </fieldset>
                              </form>
                       </div>";
    }


    /**
    * @param String $updatedBlogPostId
	* @param String $statusMessage
	* @param String $blogHeader
	* @param String $blogText
    * @return String HTML
    *
    * return -> edit redigera blog post
    */
    public function returnEditPostForm($updatedBlogPostId, $statusMessage, $blogHeader, $blogText) {
        return"
					<div id='editblog'>
						<h2>Edit your blogpost</h2>
                         <form action='?".$this->applicationModel->m_editBlogPostURL."=$updatedBlogPostId' method='post' enctype='multipart/form-data'>
                                <fieldset>
                                    <p>$statusMessage</p>
                                     <label for='blogHeader'>Headline:</label>
                                     <input type='text' size='50' name='".$this->applicationModel->m_postUpdatedBlogHeader."' id='blogHeader' value='$blogHeader' />
                                     <label for='blogText' >Blogtext:</label>
                                     <textarea type='text' rows='6' cols='30' name='".$this->applicationModel->m_postUpdatedBlogText."' id='blogText' />$blogText</textarea>
                                     <input class='update' type='submit' name='".$this->applicationModel->m_formSubmit."'  value='Update' id='RegistreraID' />
                                  </fieldset>
                          </form>
                   	 </div>";
    }


    /**
    * @param String $commentStatusMessage
    * @param String $commentText
    * @param String $id
    * @return String HTML
    *
    * return -> skapa ny kommentar
    */
    public function returnCommentForm($commentStatusMessage, $commentText, $id) {
        return"
                        <div id='addcomment'>
                             <h2>Add new comment to blogpost</h2>
                               <form action='?".$this->applicationModel->m_addCommentURL."=$id' method='post' enctype='multipart/form-data'>
                                   <fieldset>
                                       <p>$commentStatusMessage</p>
                                       <label for='commentText' >Comment Text :</label>
                                       <textarea type='text' rows='6' cols='30' name='".$this->applicationModel->m_postCommentText."' id='commentText' />$commentText</textarea>
                                       <br><br>
                                       <label for='RegistreraID' >Add new comment:</label>
                                       <input class='regi' type='submit' name='".$this->applicationModel->m_formSubmit."'  value='Register' id='RegistreraID' />
                                   </fieldset>
                               </form>
                        </div>";
    }


    /**
    * @param String $updatedComentId
	* @param String $statusMessage
	* @param String $comment
	* @return String HTML
    *
    * return -> edit redigera kommentarer
    */
    public function returnEditCommentForm($updatedComentId, $statusMessage, $commentText) {
        return"
           			<div id='editcomment'>
                        <h2>Edit your comment</h2>
                         <form action='?".$this->applicationModel->m_editCommentURL."=$updatedComentId' method='post' enctype='multipart/form-data'>
                                <fieldset>
                                    <p>$statusMessage</p>
                                     <label for='coommentText' >Comment:</label>
                                     <textarea type='text' rows='6' cols='30' name='".$this->applicationModel->m_postUpdatedCommentText."' id='commentText' />$commentText</textarea>
                                     <input class='update' type='submit' name='".$this->applicationModel->m_formSubmit."'  value='Update' id='RegistreraID' />
                                  </fieldset>
                           </form>
             		 </div>";
    }


}
